<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class GoodsAddRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'name'=>'required',
            'summary'=>'required',
            'price'=>'required',
            'cover'=>'required',
            'type'=>'required',
            'content'=>'required',
            'goods_type_id'=>'required',
            'status'=>'required',
            'stock'=>'required'
        ];
    }
    public function messages()
    {
        return [
            'name.required'=>'请输入商品名称',
            'summary.required'=>"请填写商品描述",
            'price.required'=>"请输入默认价格",
            'cover.required'=>'请选择商品封面',
            'type.required'=>'请选择商品类型',
            'content.required'=>'请填写商品内容',
            'goods_type_id.required'=>'请选择商品所属类型',
            'status.required'=>'请选择商品是否上架',
            'stock.required'=>'请输入商品默认库存'
        ];
    }
}
